package com.diver.flinkdemo.mapper.mysqlMapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.diver.flinkdemo.entity.xxt.PersonTerminalInfo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * @author zhangyj
 * @date 2023/3/29
 */
public interface PersonTerminalInfoMapper extends BaseMapper<PersonTerminalInfo> {

    @Select("SELECT a.person_id " +
            "FROM `person_terminal_info` a " +
            "INNER JOIN terminal_unit b ON a.terminal_id = b.id " +
            "WHERE a.STATUS = 1 AND a.del_flag = 0 AND b.STATUS = 1 " +
            "AND b.del_flag = 0 AND b.card_num = #{cardNum} LIMIT 1 ")
    String getBindPersonId(@Param("cardNum") String cardNum);
}
